#ifndef ANIMAL_H
#define ANIMAL_H

#include <string>
#include <iostream>

class Animal {
protected:
    std::string name;
    std::string color;
    int legNum;

public:
    // 有参构造函数
    Animal(std::string name, std::string color, int legNum);

    // set 和 get 方法
    void setName(std::string name);
    std::string getName() const;

    void setColor(std::string color);
    std::string getColor() const;

    void setLegNum(int legNum);
    int getLegNum() const;

    // 介绍自己的方法
    virtual void introduce() const;
};



std::string Animal::getName() const {
    return name;
}

void Animal::setColor(std::string color) {
    this->color = color;
}

std::string Animal::getColor() const {
    return color;
}

void Animal::setLegNum(int legNum) {
    this->legNum = legNum;
}

int Animal::getLegNum() const {
    return legNum;
}

void Animal::introduce() const {
    std::cout << "我是一只动物，名字叫" << name << "，毛色是" << color << "，有" << legNum << "条腿。" << std::endl;
}
#endif